<?php

class User extends CI_Model {

    var $fb_user_id   = '';
    var $email = '';
    var $created_date   = '';
    
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    function setUserInfo($UserInfo)
    {
        $this->fb_user_id=$UserInfo['uid'];
        $this->email=$UserInfo['email'];
    }
    function get_data()
    {
        $query = $this->db->get('user_info');
        return $query->result();
    }

    function insert_user()
    {
		$query = $this->db->query('SELECT fb_user_id FROM user_info where fb_user_id='.$this->fb_user_id);
		if($query->num_rows()>0)
		{
		}
		else
		{
			$this->created_date    = date('Y-m-d H:i:s');
			$this->db->insert('user_info', $this);
		}
    }

    function update_user($id)
    {
        $this->created_date     = date('Y-m-d H:i:s');

        $this->db->update('user_info', $this, array('user_id' => $id));
    }

}
?>
